<?php
// Module Definition
$module['name'] = 'SSL';
$module['description'] = 'Allows users to generate certificate requests and user-generated certificates.';
$module['depends'] = Array('apache');

switch($action) {
	case 'register':
		break;
	case 'unregister':
		$SQL = "DROP TABLE IF EXISTS certinfo";
		mysql_query($SQL);
		break;
	case 'enable':
		global $cfg;
		$SQL = "CREATE TABLE IF NOT EXISTS `certinfo` (
				`id` int(11) NOT NULL auto_increment,
				`siteid` bigint(10) NOT NULL default '0',
				`status` int(11) NOT NULL default '0',
				`countryname` char(2) default NULL,
				`state` varchar(64) NOT NULL default '',
				`locality` varchar(20) default NULL,
				`orgname` varchar(64) default NULL,
				`orgunit` varchar(64) default NULL,
				`commonname` varchar(64) default NULL,
				`emailaddress` varchar(64) default NULL,
				`privatekey` text,
				`csr` text,
				`cert` text,
				`reserved1` int(11) default NULL,
				`hash` varchar(255) default NULL,
				PRIMARY KEY  (`id`)
				) TYPE=MyISAM ";
		mysql_query($SQL);
		break;
	case 'disable':
		break;
	case 'hook':
		register_hook('web:menu', 'ssl_add_menu');
		register_hook('web:lang', 'ssl_add_lang');
		register_hook('web:cfg:default', 'ssl_add_cfg');
		register_hook('web:domain:ssl', 'ssl_domain_cert');

		register_hook('server:domain:update', 'server_ssl_generate');
		break;
}
?>